package com.bmt.pos.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bmt.core.BaseService;
import com.bmt.core.ISaveable;
import com.bmt.core.PageListInfo;
import com.bmt.exception.ServiceException;
import com.bmt.pos.bean.CodeTable;
import com.bmt.pos.bean.Store;
import com.bmt.pos.dao.StoreDao;

@Service("storeService")
public class StoreService extends BaseService {

	@Autowired
	private StoreDao storeDao;

	public boolean updateStore(Store store) throws ServiceException {
		try {
			int result = storeDao.update(store);
			if (result > 0) {
				return true;
			} else {
				return false;
			}
		} catch (Exception e) {
			throw new ServiceException("更新数据失败", e);
			
		}
	}

	public Store getStoreById(int id) {
		return storeDao.getStoreByColunm("ID", id);
	}

	public List<Store> getStoreList() {
		return storeDao.getStoreList();
	}

	public boolean createStore(Store store) {

		return storeDao.saveStore(store);
	}

	public List<CodeTable> getOSWList() {
		return storeDao.getOSWList();
	}

	public PageListInfo<ISaveable> getPageInfo(int pageNum) {
		return storeDao.getPageListInfo(pageNum);
	}

}
